#define _CRT_SECURE_NO_WARNINGS 1
#include <stdio.h>

int main()
{
    int num,count=0;
    scanf("%d", &num);
    count += num;
    while (num)
    {
        count += num / 2;
        num = num / 2;
    }
    printf("%d", count);
    return 0;
}